package example.array;

import java.util.Arrays;
import java.util.Collections;

/**
 * Created by lenovo on 2016/11/4 0004.
 * collections.max(),collections.min()获取数组最大值和最小值
 */
public class MaxMin {
    public static void main(String[] args){
        Integer[] numbers = {8,2,7,1,4,9,5};
        int max = Collections.max(Arrays.asList(numbers));
        int min = Collections.min(Arrays.asList(numbers));
        System.out.println("最小值："+min +"\n最大值： "+max);
    }
}
